#!/usr/bin/perl

package Example;

#For "new" sub,$_[0] is the 1st parameter in "(...)" of new expression.
#For << new Example("1111", "222");  >>, $_[0] is "1111".
#For other sub, $_[0] is self, NOT the 1st parameter in sub call expression.
#For << $ex->display("in Prompt");  >>, $_[0] is self, not "in Prompt".
 
sub new
{
	my ($class) = shift;
	bless {
			firstPara => $_[0],
			secondPara   => $_[1]
	}, $class;
}

sub display()
{
	my $self = $_[0];
	my $msg = $_[1];
	print "First Parameter:" . $self->{firstPara} . 
	"\nSecond Parameter:" . $self->{secondPara} .
	"\nPrompt:" . $msg ;
}

my $ex = new Example("1111", "222");
$ex->display("in Prompt");

	